//-------------Sonic CD R2 1 B Ani Tiles Script---------------//
//-------------------Scripted by Twanvanb1------------------//


#alias Object.Value0	:	Object.Timer
#alias Object.Value1	:	Object.AniFrame


// Priority
#alias 1	:	PRIORITY_ACTIVE

// ========================
// Main Subs
// ========================

sub ObjectMain
	Object.AnimationTimer++
	if Object.AnimationTimer == 10
		Object.AnimationTimer = 0
		Object.Frame++
		Object.Frame %= 4

		TempValue0 = 359
		TempValue0 += Object.Frame
		TempValue2 = 355
		while TempValue2 <= 358
			Copy16x16Tile(TempValue2, TempValue0)
			TempValue0 += 4
			TempValue2++
		loop

		TempValue0 = 390
		TempValue0 += Object.Frame
		Copy16x16Tile(388, TempValue0)

		TempValue0 += 4
		Copy16x16Tile(389, TempValue0)

		TempValue0 = 218
		TempValue0 += Object.Frame
		Copy16x16Tile(383, TempValue0)
	end if

	Object.Timer++
	if Object.Timer == 10
		Object.Timer = 0
		Object.AniFrame += 4
		Object.AniFrame %= 16

		TempValue0 = 202
		TempValue0 += Object.AniFrame

		TempValue2 = 384
		while TempValue2 <= 387
			Copy16x16Tile(TempValue2, TempValue0)
			TempValue0++
			TempValue2++
		loop
	end if
end sub

sub ObjectStartup
	Object[18].Type = TypeName[Block Animation]
	Object[18].Priority = PRIORITY_ACTIVE
end sub

// ========================
// Editor Subs
// ========================

sub RSDKDraw
	DrawSprite(0)
end sub


sub RSDKLoad
	LoadSpriteSheet("Global/Display.gif")
	SpriteFrame(-16, -16, 32, 32, 1, 143)		// #0 - "Script" Icon

	SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
end sub